<!DOCTYPE HTML>
<html lang="zh-tw" >
    <!-- Start book django项目 -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>string | django项目</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-emphasize/plugin.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../redis/shu-ju-cao-zuo/jian-ming-ling.html" />
    
    
    <link rel="prev" href="../../redis/shu-ju-cao-zuo.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="1.4.1"
        data-chapter-title="string"
        data-filepath="redis/shu-ju-cao-zuo/string.md"
        data-basepath="../.."
        data-revision="Mon Aug 10 2020 10:48:54 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        课程介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="redis.html">
            
                
                    <a href="../../redis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Redis
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="redis/an-zhuang.html">
            
                
                    <a href="../../redis/an-zhuang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="redis/pei-zhi.html">
            
                
                    <a href="../../redis/pei-zhi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="redis/fu-wu-duan-he-ke-hu-duan-ming-ling.html">
            
                
                    <a href="../../redis/fu-wu-duan-he-ke-hu-duan-ming-ling.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        服务端和客户端命令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="redis/shu-ju-cao-zuo.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        数据操作
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.4.1" data-path="redis/shu-ju-cao-zuo/string.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo/string.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.1.</b>
                        
                        string
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="redis/shu-ju-cao-zuo/jian-ming-ling.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo/jian-ming-ling.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.2.</b>
                        
                        键命令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="redis/shu-ju-cao-zuo/hash.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo/hash.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.3.</b>
                        
                        hash
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="redis/shu-ju-cao-zuo/list.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo/list.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.4.</b>
                        
                        list
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="redis/shu-ju-cao-zuo/set.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo/set.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.5.</b>
                        
                        set
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="redis/shu-ju-cao-zuo/zset.html">
            
                
                    <a href="../../redis/shu-ju-cao-zuo/zset.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.6.</b>
                        
                        zset
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="redis/yu-python-jiao-hu.html">
            
                
                    <a href="../../redis/yu-python-jiao-hu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        与Python交互
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="redis/yu-python-jiao-hu/strictredis.html">
            
                
                    <a href="../../redis/yu-python-jiao-hu/strictredis.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.1.</b>
                        
                        Redis
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="redis/yu-python-jiao-hu/string.html">
            
                
                    <a href="../../redis/yu-python-jiao-hu/string.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.2.</b>
                        
                        String操作
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本書使用 GitBook 釋出
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >django项目</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="string&#x7C7B;&#x578B;">string&#x7C7B;&#x578B; </h1>
<ul>
<li>&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;&#x662F; Redis &#x4E2D;&#x6700;&#x4E3A;&#x57FA;&#x7840;&#x7684;&#x6570;&#x636E;&#x5B58;&#x50A8;&#x7C7B;&#x578B;&#xFF0C;&#x5B83;&#x5728; Redis &#x4E2D;&#x662F;&#x4E8C;&#x8FDB;&#x5236;&#x5B89;&#x5168;&#x7684;&#xFF0C;&#x8FD9;&#x4FBF;&#x610F;&#x5473;&#x7740;&#x8BE5;&#x7C7B;&#x578B;&#x53EF;&#x4EE5;&#x63A5;&#x53D7;&#x4EFB;&#x4F55;&#x683C;&#x5F0F;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x5982;JPEG&#x56FE;&#x50CF;&#x6570;&#x636E;&#x6216;Json&#x5BF9;&#x8C61;&#x63CF;&#x8FF0;&#x4FE1;&#x606F;&#x7B49;&#x3002;&#x5728;Redis&#x4E2D;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;&#x7684;Value&#x6700;&#x591A;&#x53EF;&#x4EE5;&#x5BB9;&#x7EB3;&#x7684;&#x6570;&#x636E;&#x957F;&#x5EA6;&#x662F;512M&#x3002;</li>
</ul>
<h1 id="&#x4FDD;&#x5B58;">&#x4FDD;&#x5B58; </h1>
<p>&#x5982;&#x679C;&#x8BBE;&#x7F6E;&#x7684;&#x952E;&#x4E0D;&#x5B58;&#x5728;&#x5219;&#x4E3A;&#x6DFB;&#x52A0;&#xFF0C;&#x5982;&#x679C;&#x8BBE;&#x7F6E;&#x7684;&#x952E;&#x5DF2;&#x7ECF;&#x5B58;&#x5728;&#x5219;&#x4FEE;&#x6539;</p>
<ul>
<li><p>&#x8BBE;&#x7F6E;&#x952E;&#x503C;</p>
<blockquote>
<p>set key value</p>
</blockquote>
</li>
<li><p>&#x4F8B;&#xFF1A;&#x8BBE;&#x7F6E;&#x952E;&#x4E3A;<code>name</code>&#x503C;&#x4E3A;<code>itcast</code>&#x7684;&#x6570;&#x636E;</p>
<blockquote>
<p>set name itcast</p>
</blockquote>
<p><img src="../../assets/p1_15.png" alt=""></p>
</li>
<li><p>&#x8BBE;&#x7F6E;&#x952E;&#x503C;&#x53CA;&#x8FC7;&#x671F;&#x65F6;&#x95F4;&#xFF0C;&#x4EE5;&#x79D2;&#x4E3A;&#x5355;&#x4F4D;</p>
<blockquote>
<p>setex key seconds value</p>
</blockquote>
</li>
<li><p>&#x4F8B;&#xFF1A;&#x8BBE;&#x7F6E;&#x952E;&#x4E3A;<code>aa</code>&#x503C;&#x4E3A;<code>aa</code>&#x8FC7;&#x671F;&#x65F6;&#x95F4;&#x4E3A;3&#x79D2;&#x7684;&#x6570;&#x636E;</p>
<blockquote>
<p>setex aa 3 aa</p>
</blockquote>
<p><img src="../../assets/p1_16.png" alt=""></p>
</li>
<li><p>&#x8BBE;&#x7F6E;&#x591A;&#x4E2A;&#x952E;&#x503C;</p>
<blockquote>
<p>mset key1 value1 key2 value2 ...</p>
</blockquote>
</li>
<li><p>&#x4F8B;&#xFF1A;&#x8BBE;&#x7F6E;&#x952E;&#x4E3A;<code>a1</code>&#x503C;&#x4E3A;<code>python</code>&#x3001;&#x952E;&#x4E3A;<code>a2</code>&#x503C;&#x4E3A;<code>java</code>&#x3001;&#x952E;&#x4E3A;<code>a3</code>&#x503C;&#x4E3A;<code>c</code></p>
<blockquote>
<p>mset a1 python a2 java a3 c</p>
</blockquote>
<p><img src="../../assets/p1_17.png" alt=""></p>
</li>
</ul>
<h1 id="&#x83B7;&#x53D6;">&#x83B7;&#x53D6; </h1>
<ul>
<li><p>&#x83B7;&#x53D6;&#xFF1A;&#x6839;&#x636E;&#x952E;&#x83B7;&#x53D6;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x4E0D;&#x5B58;&#x5728;&#x6B64;&#x952E;&#x5219;&#x8FD4;&#x56DE;<code>nil</code></p>
<blockquote>
<p>get key</p>
</blockquote>
</li>
<li><p>&#x4F8B;&#xFF1A;&#x83B7;&#x53D6;&#x952E;<code>name</code>&#x7684;&#x503C;</p>
<blockquote>
<p>get name</p>
</blockquote>
</li>
<li><p>&#x6839;&#x636E;&#x591A;&#x4E2A;&#x952E;&#x83B7;&#x53D6;&#x591A;&#x4E2A;&#x503C;</p>
<blockquote>
<p>mget key1 key2 ...</p>
</blockquote>
</li>
<li><p>&#x4F8B;&#xFF1A;&#x83B7;&#x53D6;&#x952E;<code>a1&#x3001;a2&#x3001;a3</code>&#x7684;&#x503C;</p>
<blockquote>
<p>mget a1 a2 a3</p>
</blockquote>
<p><img src="../../assets/mget.png" alt=""></p>
</li>
</ul>
<h1 id="&#x5220;&#x9664;">&#x5220;&#x9664; </h1>
<p>&#x8BE6;&#x2EC5;&#x4E0B;&#x8282;&#x952E;&#x7684;&#x64CD;&#x4F5C;&#xFF0C;&#x5220;&#x9664;&#x952E;&#x65F6;&#x4F1A;&#x5C06;&#x503C;&#x5220;&#x9664;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../redis/shu-ju-cao-zuo.html" class="navigation navigation-prev " aria-label="Previous page: 数据操作"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../redis/shu-ju-cao-zuo/jian-ming-ling.html" class="navigation navigation-next " aria-label="Next page: 键命令"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"fontsettings":{"family":"sans","size":2,"theme":"white"},"toggle-chapters":{},"splitter":{},"emphasize":{},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book django项目 -->
</html>
